// 车险表格，表头配置
import stateStore from '@/components/ivew_conf/state_store'
const companyIcon = () => import('@/components/ivew_components/company_icon/index.vue')
 
let carStatusStore = new stateStore();

// 布尔值显示转换
function trueOrFalse(key:string):any{
    return function (h, {row, column, index}){

        let val = row[key];
        return h('c-has-label', {props:{
            val,
        }})
        
    }
}

// 价格值显示转换
function valueColor(key:string):any{

    return function (h, {row, column, index}){
        let val = row[key];
        
        return h('div', {
            style: {
                color: '#ff5959',
                fontSize: '1rem'
            }
        }, [val])
        
    }
}

// 复制内容
function copy(key:string):any{
    return function(h, {row, column, index}){
        let val = row[key];
        return h('c-copy-txt-label',[val])
    }
}



const carTableTitle:tableInf.tableTitle[] = [
    
    {
        type:'index',
        width: 60,
        fixed: 'left',
        align:'center',
        renderHeader (h, {row, column, index}){

            return  h('h1',{
                style: {
                    color: '#4885ff',
                }
            },['#'])
        }
    },
    {
        title: '订单号',
        width: 160,
        key: 'orderId',
        ellipsis:true,
        render: copy('orderId'),
    },
    {
        title: '订单状态',
        width: 120,
        fixed: 'right',
        key: 'status',
        ellipsis:true,
       render(h, {row, column, index}){

            return h('c-status-label',{props:{
                val: carStatusStore.getVal(row.status)
            }})
            
        }
    },
    {
        title: '出单人',
        width: 100,
        key: 'memberNickname',
        ellipsis:true,
    },
    {
        title: '车主',
        width: 140,
        key: 'ownerNickname',
        ellipsis:true,
    },
    {
        title: '被保人',
        width: 140,
        key: 'assuredNickname',
        ellipsis:true,
    },
    {
        title: '承保公司',
        width: 140,
        key: 'viCompany',
        fixed: 'left',
        ellipsis:true,
        render (h, {row, column, index}){

            return h(companyIcon, {
                props: {
                    company: row['viCompany']
                }
            })

        }
    },
    {
        title: '车牌号',
        width: 120,
        key: 'plateNo',
        ellipsis:true,
        render: copy('plateNo')
    },
    {
        title: '车架号',
        width: 200,
        key: 'vin',
        ellipsis:true,
        render: copy('vin')
    },
    {
        title: '发动机号',
        width: 160,
        key: 'engineNo',
        ellipsis:true,
        render: copy('engineNo')
    },
    {
        title: '购买商业险',
        width: 120,
        key: 'pickSy',
        ellipsis:true,
        render: trueOrFalse('pickSy')
    },
    {
        title: '购买交强险',
        width: 120,
        key: 'pickJq',
        ellipsis:true,       
        render: trueOrFalse('pickJq')
    },
    {
        title: '代缴车船税',
        width: 120,
        key: 'pickVehicleTax',
        ellipsis:true,
        render: trueOrFalse('pickVehicleTax')
    },
    {
        title: '商业保费(元)',
        width: 120,
        key: 'syAmount',
        ellipsis:true,
        render: valueColor('syAmount')
    },
    {
        title: '交强保费(元)',
        width: 120,
        key: 'jqAmount',
        ellipsis:true,
        render: valueColor('jqAmount')
    },
    {
        title: '车船税(元)',
        width: 120,
        key: 'vehicleTaxAmount',
        ellipsis:true,
        render: valueColor('vehicleTaxAmount')
    },
    {
        title: '出单人所属公司',
        width: 160,
        key: 'memberCompany',
        ellipsis:true,
    },
    {
        title: '出单人所属部门',
        width: 140,
        key: 'memberDeaprtment',
        ellipsis:true,
    },
    
    {
        title: '车辆型号',
        width: 300,
        key: 'vehicleModel',
        ellipsis:true,
    },
    {
        title: '使用性质',
        width: 100,
        key: 'vehicleUseCharacter',
        ellipsis:true,
    },
    {
        title: '座位(位)',
        width: 100,
        key: 'vehicleSeats',
        ellipsis:true,
    },
    {
        title: '载重(吨)',
        width: 100,
        key: 'vehicleTonnages',
        ellipsis:true,
    },
    {
        title: '排量(升)',
        width: 100,
        key: 'vehicleEngineCapacity',
        ellipsis:true,
    },
    {
        title: '整备质量(吨)',
        width: 140,
        key: 'vehicleWeight',
        ellipsis:true,
    },
    {
        title: '车身价(元)',
        width: 140,
        key: 'vehiclePrice',
        ellipsis:true,
    },
    {
        title: '车辆类型',
        width: 100,
        key:'vehicleType',
        ellipsis:true,
    },
    {
        title: '过户',
        width: 80,
        key:'isTransfered',
        ellipsis:true,
        render: trueOrFalse('isTransfered')
    },
    {
        title: '注册日期',
        width: 100,
        key: 'registerDate',
        ellipsis:true,
    },
    {
        title: '建档人',
        width: 100,
        key: 'userAgentFlag',
        ellipsis:true,
    },
    {
        title: '建档日期',
        width: 100,
        key: 'createAt',
        ellipsis:true,
    },
    {
        title: '更新日期',
        width: 100,
        key: 'updateAt',
        ellipsis:true,
    },
   
   
    
    
]

export default carTableTitle;